import Vue from '@/main.js';









export  function getUserList(userCode, userName,status, pageNum, pageSize, unitType, unitId) {
  var path = "/auth/user/getUserList";
  return Vue.$http.post(path, {
      name: userName,
      account: userCode,
      status: status,
      pageNum: pageNum,
      pageSize: pageSize,
      unitType: unitType,
      unitId: unitId
    })
    .then((res) => {
        return res.data.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}








export  function deleteUser(userId) {
  var path = "/auth/user/deleteUserOnLogic?userId="+userId;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}

export  function binding(userAccountId, populationInformationId, bindingType) {
  var path = "/auth/user/bindingPopulationInfo?userId="+userAccountId+"&populationInformationId="+populationInformationId+"&bindingType="+bindingType;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}

export  function unbinding(userAccountId, populationInformationId) {
  var path = "/auth/user/unbindingPopulationInfo?userId="+userAccountId+"&populationInformationId="+populationInformationId;
  return Vue.$http.get(path)
    .then((res) => {
        return res.data;
    })
    .catch(function (error) {
      console.log(error);
    });
}



export function getDictionaryList(category) {
  var path = "/business/dictionary/queryList?category=" + category;
  return Vue.$http.get(path)
    .then((res) => {
      return res.data;
    })
    .catch(function (error) {
      console.error(error);
    });
}




export  function changePublic(id, isPublic) {
  var path = "/auth/user/changePublic";
  return Vue.$http.post(path, {
      userId:id,
      isPublic: isPublic
    })
    .then((res) => {
        return res;
    })
    .catch(function (error) {
      console.log(error);
    });
}
